package 特定类型方法引用;

import java.util.Arrays;
import java.util.Comparator;

public class Test {
    public static void main(String[] args) {
        String[] names = {"body", "angela", "Andy", "dlei", "caocao", "Cici"};

        //Arrays.sort(names);

//        Arrays.sort(names,new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                return o1.compareToIgnoreCase(o2);
//            }
//        });


        //简化
//        Arrays.sort(names, ( o1,  o2) -> o1.compareToIgnoreCase(o2));

        //特定类型的方法引用
        Arrays.sort(names, String::compareToIgnoreCase);
        System.out.println(Arrays.toString(names));

}
}
